package keer.httpinterface.test;

import keer.httpinterface.annotation.AnnotationConfigure;
import keer.httpinterface.annotation.Request;
import keer.httpinterface.utils.AnnotationInfo;
import keer.httpinterface.utils.AnnotationUtils;

import java.lang.reflect.Method;

public class AnnotationContextUtils {
    public static AnnotationConfigure.AnnotationContext create(Class<?> clazz,
                                                               String method,
                                                               Object proxy,
                                                               Class... methodParamTypes) throws NoSuchMethodException {
        Method m = clazz.getDeclaredMethod(method, methodParamTypes);
        AnnotationInfo info = AnnotationUtils.getMethodAnnotation(m, Request.class, Boolean.TRUE);
        return new AnnotationConfigure.AnnotationContext(clazz, m, info, proxy);
    }

}
